package com.example.find_module;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewbinding.ViewBinding;

import com.example.common.mvvm.view.BaseFragment;
import com.example.find_module.databinding.FragmentFindBinding;

import java.util.ArrayList;
import java.util.List;

public class FindFragment extends BaseFragment<FragmentFindBinding,FindViewModel> {
    private List<Fragment> list=new ArrayList<>();
    private List<String>title=new ArrayList<>();

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        list.add(new FindTabFragment());
        list.add(new FindTabFragment());
        title.add("关注");
        title.add("推荐");
    }

    @Override
    public View bindLayout() {
        return v.getRoot();
    }

    @Override
    public ViewBinding initBinding() {
        FragmentFindBinding binding=FragmentFindBinding.inflate(inflater);
        return binding;
    }

    @Override
    public void initView() {
        FindTabAdapter tabAdapter = new FindTabAdapter(getChildFragmentManager(), FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT, list, title);
        v.findVp.setAdapter(tabAdapter);
        v.findTab.setViewPager(v.findVp);
        v.findTab.setTextSelectColor(Color.parseColor("#FF86A6"));
        v.findTab.setTextUnselectColor(Color.parseColor("#2D2D2D"));
        v.findTab.setIndicatorColor(Color.parseColor("#FF86A6"));
        v.findTab.setIndicatorWidth(10);
    }

    @Override
    public void initData() {

    }
}
